var express = require('express');
var router = express.Router();

/* GET users listing. */
router.get('/', function(req, res, next) {
  res.send('respond with a resource');
});

router.get('/abc', function(req, res, next) {
  // res.send('respond with a resource');

  // res.send("hello"); // "string"
  // res.send("<h2>hello</h2>"); // "html"

  // res.json({name:"user",age:18}); // "json"

  var obj = {name:"user",age:18};
  var str = JSON.stringify(obj);
  res.type("text/javascript");
  res.send(`fn(${str})`); // "jsonp"    // 函数调用格式的字符串 (带有json格式的数据)
});

module.exports = router;
